<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
	String path=request.getContextPath();
	String basePath=request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>   
<!DOCTYPE html>
<html>
<head>
<base href="<%=basePath%>>"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>登录</title>
	<style>
		body{
			font-size:14px;
		}
	</style>
</head>
<body>
	<div align="center">
	<table>
		<tr><td></td><td>姓名</td><td>性别</td><td>电话</td><td colspan="3">设置职位权限</td></tr>
		<c:forEach var="item" items="${query}">
			<tr>
				<td><input type="checkbox" class="userId" name="iUserId" value="${item.iUserId}"/></td>
				<td>${item.sName}</td>
				<td>${item.sSex}</td>
				<td>${item.sTel}</td>
				<c:forEach items="${role}" var="item">
					<td><input type="checkbox" class="roleId" value="${item.iRoleId}"/>${item.sName}</td>
				</c:forEach>
		</c:forEach>
		<tr><td colspan="7"><input type="button" value="确定" onclick="doUpdate()"/></td></tr>
	</table>
	</div>
</body>
	<script type="text/javascript" src="js/jquery-3.2.1.js"></script>
	<script type="text/javascript">
		function doUpdate(){
			if($(".userId:checked").length!=1){
				alert("请选择一项进行修改");
				return false;
			}
			if($(".roleId:checked").length<=0){
				alert("请选择职位");
				return false;
			}
			var str = "manager/powerUpdate.action?iUserId="+$(".userId:checked").val();
			for(var i=0;i<$(".roleId:checked").length;i++){
				str+="&iRoleIds="+$(".roleId:checked").eq(i).val();
			}
			window.location = str;
		}
	</script>
</html>